<%@page import="org.springframework.web.context.support.WebApplicationContextUtils"%>
<%@page import="org.springframework.context.ApplicationContext"%>
<%@page import="java.util.List"%>
<%@page import="com.bill.common.user.dto.RegisterUserGridDTO"%>
<%@page import="com.bill.common.user.service.IRegisterUserService"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"  pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> 
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ include file="../language.jsp" %>
<%
String loginName = request.getParameter("loginName");
String registerLocation = request.getParameter("registerLocation");;
ApplicationContext ac = WebApplicationContextUtils.getWebApplicationContext(getServletContext());
IRegisterUserService registerUserService = (IRegisterUserService)ac.getBean("registerUserService");
List<RegisterUserGridDTO> registerUserGridDTOs = registerUserService.findContactNo(loginName,registerLocation);
request.setAttribute("registerUserGridDTOs",registerUserGridDTOs);
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title><fmt:message key="i18n.pelaseSelect"/><fmt:message key="contactuser"/></title>
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1" />
	<script type="text/javascript" src="../scripts/jquery/jquery-1.4.2.min.js"></script>
    <link rel="stylesheet" href="../bootstrap/css/bootstrap.min.css" />
    <link rel="stylesheet" href="../bootstrap/css/bootstrap-responsive.min.css" />
</head>
<body style="padding: 25px;">
<script type="text/javascript">
var isHaveData = true;
</script>


<c:forEach items="${registerUserGridDTOs}" var="data">
	<fmt:message key="i18n.loginName"/>:${data.loginName } , <fmt:message key="i18n.piUserName"/>:${data.userName } , <fmt:message key="i18n.userlevel"/>:<fmt:message key="${data.registerLevel }"/> , <a href="javascript:selectUser('${data.loginName }','${data.registerLocation }')">[<fmt:message key="i18n.choice"/>]</a><br><br>
</c:forEach>

<c:if test="${empty registerUserGridDTOs}">
	<br/><br/>
	<script type="text/javascript">
	isHaveData = false;
	</script>
	System can not find the contact person, <br/>please note about the selected area!.<br><br/>（系统未找到接点人，请注意所选择的左右区！）
</c:if>
</body>

<script type="text/javascript">
function selectUser(login,loc) {
	if(navigator.userAgent.indexOf("Chrome") >0 ){
		window.opener.select(login,loc);
		window.close();
	}else{
	    window.returnValue = login+","+loc; 
	    window.opener = null; 
	    window.close(); 
	}
}
if(isHaveData){
	
}else{
	//alert("System can not find the contact person, please note about the selected area!.<br>系统未找到接点人，请注意所选择的左右区！");
}
</script>
</html>